home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / utilities / pu036.dms / pu036.adf / Example.bas < prev    next >
BASIC Source File  |  1990-06-29  |  432b  |  22 lines

  1. '
  2. ' This program prints the prime-numbers from 2 to 1000 to the screen.
  3. ' The compiled program needs 21 seconds (16 seconds without PRINT-command),
  4. ' with AmigaBASIC it takes about 226 (212) seconds on my Amiga 500
  5. '
  6.  
  7.  DEFINT a-z
  8.  
  9.  BeginTime& = TIMER
  10.  
  11.  FOR a = 2 TO 1000
  12.    FOR b = 3 TO a-1
  13.      IF b*INT(a\b) = a THEN NotPrim
  14.    NEXT b
  15.    PRINT a
  16. NotPrim:
  17.  NEXT a
  18.  
  19.  PRINT "Time needed:";TIMER-BeginTime&
  20.  
  21.  WHILE INKEY$ = "" : WEND
  22.